package com.wnxy.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * @Classname OrderService2
 * @Description :
 * @Date 2021/2/25 16:21
 * @Created by Yeheng
 */
@Service
public class OrderService2 {

    @SentinelResource(value = "getme",fallback = "f2")
    public String get(){
        int i = new Random().nextInt(2);
        /*if (i==1) {
            throw new RuntimeException("报错啦");
        }*/
        return "111111111111111111";
    }

    public String f1(BlockException e){
        return "!!!!"+e.toString();
    }
    public String f2(Throwable throwable){
        return "@@@@"+throwable.toString();
    }
}
